<template>
	<view>
		<scroll-view class="scroll_cont" scroll-y="false">
			<view class="wrapper">
				<view class="cont">
					<view class="fill_info_line">
						<view class="fill_info_title">买方姓名</view>
						<view class="fill_info_another checkbox_line">
							<view class="uni-input">{{ datainfo.user.user_name }}</view>
						</view>
					</view>

					<view class="fill_info_line">
						<view class="fill_info_title">方方手机号</view>
						<view class="fill_info_another checkbox_line">
							<view class="uni-input">{{ datainfo.user.mobile }}</view>
						</view>
					</view>

					<view class="fill_info_line">
						<view class="fill_info_title">匹配DT通证数</view>
						<view class="fill_info_another checkbox_line">
							<view class="uni-input">{{ datainfo.uninvest.uuniJiner }}</view>
						</view>
					</view>

					<view class="fill_info_line">
						<view class="fill_info_title">匹配时间</view>
						<view class="fill_info_another checkbox_line">
							<view class="uni-input">{{ datainfo.uninvest.uuniDate }}</view>
						</view>
					</view>
					
					
					
					<view class="fill_info_line">
						<view class="fill_info_title">付款时间</view>
						<view class="fill_info_another checkbox_line">
							<view class="uni-input">{{ datainfo.uninvest.uuniPayDate || '暂未支付' }}</view>
						</view>
					</view>

					<view class="fill_info_line">
						<view class="fill_info_title">付款方式</view>
						<view class="fill_info_cont clearfix">
							{{datainfo.uninvest.uuniPayWay == 1 ? '付给卖家' :'余额支付'}}
						</view>
					</view>
					
					<view class="fill_info_line"  v-if="datainfo.uninvest.uuniPayWay == 1 && datainfo.uninvest.uuniPay">
						<view class="fill_info_title">支付截图</view>
						<view class="fill_info_cont clearfix">
						<view class="cont">
							<image :src="getimg + datainfo.uninvest.uuniMoneyImages"></image>
						</view>
						</view>
					</view>
						
					
				</view>
				<view class="submit_btn_cont">
					<button :class="datainfo.msg != '提交' ? 'nosubmit_btn' : 'submit_btn'" @click="submit" :disabled="datainfo.msg != '提交'">{{ datainfo.msg }}</button>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			datainfo: {
			user:{user_name:''},
			uninvest:{}
			},
		
		id:0
		};

	},

	onLoad: function(e) {
		this.id = e.id;
		this.getInfo();
	},

	onPullDownRefresh() {
		// 下拉监听事件
		this.getInfo();
		setTimeout(function() {
			uni.stopPullDownRefresh();
		}, 1000);
	},

	computed: {},
	methods: {
		getInfo(e) {
			this.$api.http.get('assistance/tradinghall/yesUnPayInvest', { id: this.id }).then(res => {
				if (res.status == 200) {
					var data = res.data;
					this.datainfo = data;
					
					if (data.uninvest.uuniSuccess) this.datainfo.msg = '已确认';
					else if (data.uninvest.uuniPay) this.datainfo.msg = '提交'; //未确认
					else if (data.uninvest.uuniPay ==0) this.datainfo.msg = '未支付'; //未确认
					else this.datainfo.msg = '未知';
				} else {
					var obj = new Object();
					obj.msg = res.msg;
					this.datainfo = obj;
				}
			});
		},
		
		

		submit() {
			var that = this;
			if (that.datainfo.uninvest.uuniSuccess) {
				uni.showToast({
					title: '您已确认，无法再次确认',
					icon: 'none'
				});
				return false;
			}
			
			if (that.datainfo.uninvest.uuniPay==0) {
				uni.showToast({
					title: '对方还未付款，无法确认',
					icon: 'none'
				});
				return false;
			}

			uni.showModal({
				title: '操作提示',
				content: '是否确认到账？',
				success: function(res) {
					if (res.confirm) {
						that.datainfo.msg = '提交中'; //禁用按钮
						that.$api.http.post('assistance/tradinghall/yesUnPayInvestAction', { id: that.id }).then(res => {
							if (res.status == 200) {
								//成功执行

								uni.showToast({
									icon: 'none',
									title: res.msg,
									mask: true,
									success() {
										uni.$emit('yespay', that.id); //通知刷新列表
										setTimeout(() => {
											uni.navigateBack();
										}, 1000);
									}
								});
							} else {
								that.datainfo.msg = '提交'; //启用按钮
								uni.showToast({
									icon: 'none',
									title: res.msg,
									mask: true
								});

								return false;
							}
						});
					}
				}
			});
		}
		
		
	}
};
</script>

<style lang="scss">
.remind {
	color: #f1c013;
	font-size: 26upx;
}

.clearfix {
	zoom: 1;
	display: block;
}

.noShow {
	display: none;
}

.clearfix:after {
	content: '.';
	visibility: hidden;
	display: block;
	height: 0;
	clear: both;
}

.scroll_cont {
	background-color: #f5f5f5;
	height: 100vh;
	padding: 20upx;

	.wrapper {
		.fill_header {
			border-radius: 5upx;
			background-color: #ffffff;
			padding: 40upx;
			margin-bottom: 20upx;
			.fill_header_title {
				font-size: 26upx;
			}
			.fill_header_cont {
				margin-top: 30upx;
				.photo_img_cont {
					border: 1upx solid hsla(0, 0%, 60%, 0.3);
					width: 120upx;
					height: 120upx;
					padding: 20upx;

					.photo_img {
						width: 80upx;
						height: 80upx;
					}
				}
			}
		}

		.cont {
			border-radius: 5upx;
			background-color: #ffffff;
			padding: 40upx;

			.fill_info_line {
				margin-top: 30upx;

				.fill_info_title {
					font-size: 26upx;
				}

				.fill_info_cont {
					position: relative;
					border-bottom: 1upx solid hsla(0, 0%, 60%, 0.3);

					.pwdInput {
						font-size: 26upx;
						height: 80upx;
						line-height: 80upx;
						border: none;
						display: block;
						outline: none;
					}

					.pwd_icon {
						width: 85upx;
						height: 85upx;
						-webkit-transform: scale(0.4);
						transform: scale(0.4);
						position: absolute;
						top: 0;
						right: 0;
					}
				}
				.fill_info_another {
					border-bottom: 1upx solid hsla(0, 0%, 60%, 0.3);
					margin-top: 24upx;
					label {
						font-size: 14upx;
					}
				}
				.checkbox_line {
					padding: 0 0px 14px;
					.uni-input {
						text-indent: 0;
						background: #ffffff;
					}
				}
			}

			.fill_info_line:first-child {
				margin-top: 0;
			}
		}
	}

	.submit_btn_cont {
		margin-top: 20upx;

		.submit_btn {
			border-radius: 5upx;
			color: #ffffff;
			font-size: 26upx;
			background: linear-gradient(90deg, #4e8cff, #2f79ff);
		}

		.nosubmit_btn {
			border-radius: 5upx;
			color: #ffffff;
			font-size: 26upx;
			background: linear-gradient(90deg, #c6c5c5, #cdced0);
		}
	}
}
</style>
